home *** CD-ROM | disk | FTP | other *** search
Wrap
/* $VER: MIMIG 1.0 (16.9.98) */ /* $AUTH: Kai Weber <kai.weber@gmx.net> */ PATH_MUIREXX = "sys:rexxc/MuiRexx" PATH_NETSTAT = "MIAMI:MiamiNetStat" WAIT_SECS = 2 /* - DO NOT CHANGE IF YOU DONT KNOW WHAT YOU DO ----------------------------- */ NL = '0a'x options results /* TAG ID definitions */ MUIA_List_Format = 0x80423c0a MUIM_Application_OpenConfigWindow = 0x804299ba MUIV_List_Insert_Bottom = -3 MUIA_List_Quiet = 0x8042d8c7 MUIA_List_Entries = 0x80421654 MUIV_List_Select_Off = 0 /* - START ------------------------------------------------------------------ */ if ~show('l', "rexxreqtools.library") then do;call addlib('rexxreqtools.library',0,-30,0);end if ~show('ports',MIMIG) then do if exists(PATH_MUIREXX) then do address command 'run <nil: >nil: 'PATH_MUIREXX' PORT MIMIG' end else do call rtezrequest( "Can not find MUIRexx!"|| NL ||"Please go and configure"|| NL ||, "the script or your system","OK","Fatal Error",'RT_REQPOS=REQPOS_CENTERSCR RTGS_WIDTH=150' ) exit end address command 'waitforport 'MIMIG end /* - MAIN -------------------------------------------------------------------- */ m1 = 0 /* Miami active var */ m2 = 0 /* Miami online var */ m3 = 0 /* Miami offline var */ main: call buildwin do forever call testonline call read end exit /* - BUILDWIN ---------------------------------------------------------------- */ buildwin: address MIMIG window ID MAIN TITLE '"Mimig 1.0 © 1998 by Kai Weber"' COMMAND "quit" PORT MIMIG group FRAME LABEL 'Output' list ID LST TITLE '"\033b\033cNo.,\033b\033cProtocol,\033b\033cRecv-Q,\033b\033cSend-Q,\033b\033cLocal Adress,\033b\033cForeign Address,\033b\033c(state)"' ATTRS MUIA_List_Format '"P=\033c BAR,P=\033r BAR,P=\033r BAR,BAR,BAR,BAR,"' MUIV_List_Select_Off endgroup space 2 group FRAME LABEL 'Status' text ID TXT endgroup endwindow return /* - READ -------------------------------------------------------------------- */ read: address command PATH_NETSTAT '>t:netstat.txt -N' if open(file,"t:netstat.txt",'R') THEN DO i=0 call testmimig address MIMIG list ID LST STRING do until eof(file) line = readln(file) if substr(line,1,3) = "Act" | substr(line,1,3)="Pro" | substr(line,1,1) =" " then nop else do i=i+1 parse var line with 1 name +5 With 7 recvq +6 with 14 sendq +6 with 22 locad +21 with 45 forad +21 with 68 stat +11 call testmimig list id LST POS MUIV_List_Insert_Bottom INSERT STRING i','name','recvq','sendq','locad','forad','stat end end end if close(file) then address command 'wait ' WAIT_SECS 'sec' return /* - TESTMIAMI -------------------------------------------------------------- */ testmiami: do forever call testmimig if ~show('port',MIAMI.1) then do if m1 = 0 then do address MIMIG text ID TXT LABEL 'Miami not found.' m1 = 1 m2 = 0 m3 = 0 end nop end else do leave end end return /* - TESTONLINE ------------------------------------------------------------- */ testonline: do forever call testmiami address MIAMI.1 IsOnline if rc=0 then do if m3 = 0 then do address MIMIG text ID TXT LABEL 'Miami is offine.' m3 = 1 m2 = 0 end nop end else do if m2 = 0 then do address MIMIG text ID TXT LABEL 'Miami is online.' m2 = 1 m3 = 0 end leave end end return /* - TESTMIMIG -------------------------------------------------------------- */ testmimig: if ~show('port',MIMIG) then exit return